Skip to content

test: regression for #402 — RawPlutusData inline datum CBOR round-trip#493

Merged
cffls merged 1 commit into
Python-Cardano:mainfrom
OscarOzaine:test/regression-402-raw-plutus-inline-datum
Jun 14, 2026
Merged

test: regression for #402 — RawPlutusData inline datum CBOR round-trip#493
cffls merged 1 commit into
Python-Cardano:mainfrom
OscarOzaine:test/regression-402-raw-plutus-inline-datum

Conversation

@OscarOzaine

@OscarOzaine OscarOzaine commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

What this does

Adds a regression test that guards against issue #402: unsigned DEX transactions exported by wallets (e.g. Eternl) were getting corrupted when PyCardano decoded and re-encoded them.

Why it matters

These transactions contain outputs with inline Plutus datums encoded as indefinite-length CBOR. Before the fixes in #474 and #479, decoding and re-serializing such a transaction changed the body bytes. Since a transaction's id is the blake2b hash of those bytes, the id changed too — which made any externally-computed signature invalid and caused nodes to reject the transaction.

This test makes sure that bug can't quietly come back.

What the test checks

Using a real Liqwid DEX transaction (Conway era, two outputs with complex inline datums) as a fixture, it verifies:

  1. Byte-exact round-tripfrom_cbor()to_cbor_hex() returns the original bytes.
  2. Both inline datums survive — both outputs still carry their datum after decode.
  3. Stable transaction id — the recomputed id matches the known-good value.
  4. Signature stays valid — signing the body hash produces a signature that verifies (checked directly with nacl).

Scope

Test-only change — one new test in test/pycardano/test_transaction.py. No library code is touched.

…CBOR round-trip

Adds test_sign_dex_transaction_with_raw_plutus_data_inline_datum using
the Liqwid DEX fixture (Conway era, two outputs with complex inline Plutus
datums). Asserts full CBOR round-trip, stable tx.id, and that a signature
over the body hash verifies correctly — the exact sequence that broke
before fixes Python-Cardano#474 and Python-Cardano#479.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.58%. Comparing base (46382fd) to head (463db45).
⚠️ Report is 37 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #493      +/-   ##
==========================================
- Coverage   90.62%   90.58%   -0.04%     
==========================================
  Files          34       34              
  Lines        5154     5154              
  Branches      781      781              
==========================================
- Hits         4671     4669       -2     
- Misses        304      305       +1     
- Partials      179      180       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cffls

cffls commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Thanks for adding the test!

@cffls cffls merged commit 3bc5677 into Python-Cardano:main Jun 14, 2026
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants